/**
 * 
 */
package org.dragonfire.dasm.directives;

import java.util.ArrayList;

import org.dragonfire.dasm.Command;
import org.dragonfire.dasm.Listing;
import org.dragonfire.dasm.DirectiveManager.Directive;

/**
 * @author Darth Android
 * @version 2.0
 */
// TODO redo documentations
public class Define extends Directive {

	/**
	 * {@inheritDoc}
	 */
	@Override
	public ArrayList<Listing> pass1(Command c) {
		String[] params = c.getParams();
		if (getCompiler().getBooleanParam("compat-tasm")) {
			params = c.getParam(0).split("\\s+", 2);
			params[0] = "\"" + params[0] + "\"";
		}
		String[] internalParams = new String[] {
				"\"define\"", params[0], params.length > 1 ? params[1] : ""
		};
		return getDM().pass1(new Command("#definternal", internalParams));
	}
}
